package com.humanmonth.util.effect
{
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.filters.DropShadowFilter;
	
	/**
	 * 物体被点击托动时的效果
	 */
	public class ClickMovingEffect
	{
		/**
		 *阴影效果 
		 */
		private var shadow : DropShadowFilter;
		public function ClickMovingEffect()
		{
			shadow=new DropShadowFilter();
			shadow.angle = 46;
			shadow.distance = 7;
			shadow.alpha = 0.4;
		}
		
		public function applyFilter(obj:DisplayObject):void{
			obj.addEventListener(MouseEvent.MOUSE_DOWN,addFilter);
			obj.addEventListener(MouseEvent.MOUSE_UP,minusFilter);
		}
		
		private function addFilter(event:MouseEvent):void{
			var obj:DisplayObject=DisplayObject(event.currentTarget);
			EffectUtil.addFilter(obj,this.shadow);		
		}
		
		private function minusFilter(event:MouseEvent):void{
			var obj:DisplayObject=DisplayObject(event.currentTarget);
			EffectUtil.minusFilter(obj,this.shadow);
		}
	}
}